package com.orange.core.pojo.entity.permission;

import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.LinkedHashSet;
import java.util.Set;

@Data
@Accessors(chain = true)
public class Permission implements Serializable {

    private Integer id;

    private String name;

    private String identifier;

    private Set<Permission> children = new LinkedHashSet<>();

    public static Permission of(int id, String name, String identifier) {
        return new Permission().setId(id).setName(name).setIdentifier(identifier);
    }

    public static Permission of(Permission permission) {
        return new Permission().setId(permission.id).setName(permission.name).setIdentifier(permission.identifier);
    }
}
